set format="docx:Office Open XML Text"|set format=docx|set format=odt|set format=pdf|set format=txt
#newl taskkill /f /im soffice.bin
#newl start "office" "D:\apps\LibreOffice4\program\soffice.exe" |-program file-
--headless |-no gui-
#remark inifilter, needed for unsigned utf-8 .txt files|--infilter="Text (encoded):UTF8" |-inifilter, needed for unsigned utf-8 .txt files.-
--convert-to %format% |-format output-
--outdir "#path" |--outdir "#pathdocx" |
"#item" |-input-
#newl Timeout /T 30 |#newl Timeout /T 45 |#newl Timeout /T 60 |#newl Timeout /T 15 |--timeout--
#newl taskkill /f /im soffice.bin && del "#path#name.docx"

<comment>
Convert documents to docx, using libre office.
If not finished in 30 sec, terminate it.
Warm up libre office by starting it up and shutting it once before running the script.
-
Note: there is no Wait in the first start command.
Del command near the end, will delete incomplete converted file.
We use '.docx' instead of '%format%', cause you can't delete "docx:Office" colon thing.
Delete will be done if killing process is succesfull.




TASKKILL /FI "IMAGENAME eq soffice.*" /F /IM *
taskkill /f /im soffice.bin
when you close bin, exe closes too? check it.



#newl taskkill /f /im soffice.bin && echo worked || echo not worked

